package com.person.controller;

import com.person.common.CommonResult;
import org.springframework.cloud.client.discovery.DiscoveryClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestOperations;

import javax.annotation.Resource;

@RestController
@RequestMapping("/consumer92")
public class ConsumerOrderController {
    @Resource
    RestOperations getRestTempalte;

    @Resource
    private DiscoveryClient discoveryClient;

    public final static String INVOKE_URL = "http://mysonsulconsumer8006";
    @GetMapping("/find")
    public CommonResult get(){
        System.out.println(discoveryClient.getServices());
        return getRestTempalte.getForObject("http://mysonsulconsumer8006/paymentcontroller8006/find/1",CommonResult.class);
    }
}
